<?php
    include_once('../src/classes/class.login.php');
    include_once('../src/classes/class.mssql.php');
    
    session_start();
    
    $login = new Login();
    if ($login->giveId() != $_GET['id'])
    {
     header('location: http://'.$_SERVER['HTTP_HOST'].'/');
    }
    $db = new MSSQL();
    $result = $db->fetch_array($db->query("SELECT comtec_id_mainteiner FROM users WHERE comtec_id_user = ".$login->giveId()));   
    $comtec_id_mainteiner = $result['comtec_id_mainteiner'];
    
    $result = $db->fetch_array($db->query("SELECT company_name FROM mainteiner WHERE comtec_id_mainteiner = $comtec_id_mainteiner"));   
    $company_name = $result['company_name'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>RF Mantencion - Panel</title>
    <link rel="stylesheet" href="../css/comtec.css" type="text/css">
    <script type="text/javascript" src="../js/jquery.js"></script>
    
    <script type="text/javascript">
        $(document).ready(function(){
	    var mainMenu = '<ul class="mainMenu">';
            mainMenu += '<li><a href="http://<?=$_SERVER['HTTP_HOST'];?>/<?=$_SESSION['context']?>/panel.php?id=<?=$_GET['id'];?>">Inicio</a></li>';
            mainMenu += '<li><a href="http://<?=$_SERVER['HTTP_HOST'];?>/operations/index.php?id=<?=$_GET['id'];?>">Operaciones</a></li>';
            <? if($_SESSION['users']!="clients"){ ?>
            mainMenu += '<li><a href="http://<?=$_SERVER['HTTP_HOST'];?>/registers/index.php?id=<?=$_GET['id'];?>">Registros</a></li>';         
            <? }?>
            mainMenu += '<li><a href="http://<?=$_SERVER['HTTP_HOST'];?>/reports/index.php?id=<?=$_GET['id'];?>"style="color: yellow" id="home">Informes</a></li>';
            mainMenu += '</ul>';
            $("#mainMenu").html(mainMenu);
	    $("#userPanel").load("http://<?=$_SERVER['HTTP_HOST'];?>/div/userPanel.php?id=<?=$_GET['id'];?>");
	    $("#enterpriseData").load("http://<?=$_SERVER['HTTP_HOST'];?>/div/enterpriseData.php?id=<?=$_GET['id'];?>");
	});     
      
    </script>
</head>
<body>
    <div id="contenedor">
	<div id="title"><h1>RF Mantenci&oacute;n</h1><div id="enterpriseData"><h3><?=$company_name?></h3></div></div>
	<div id="userPanel"></div>
	<div id="mainMenu"></div>       
        <div id="subtitle"><h2>Informes</h2></div>
        <div id="infoPanel">
        </div>
        <div id="resultPanel"></div>
        <input type="hidden" id="comtec_id_mainteiner" value="<?=$comtec_id_mainteiner;?>" />    
        <br />
        <div id="footer">&copy; 2011 ComTec Ltda. Todos los derechos reservados.</div>
    </div>   
   </body>
</html>